/*
 *接口编写处...
*如果接口需要做Action的权限验证，请在Action上使用属性
*如: [ApiActionPermission("Tb_Project_Fundtemplate",Enums.ActionPermissionOptions.Search)]
 */
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.AspNetCore.Http;
using MYData.Entity.DomainModels;
using MYData.System.IServices;
using MYData.Entity.DTO.ApiEntity.Input;

namespace MYData.System.Controllers
{
    public partial class Tb_Project_FundtemplateController
    {
        private readonly ITb_Project_FundtemplateService _service;//访问业务代码
        private readonly IHttpContextAccessor _httpContextAccessor;

        [ActivatorUtilitiesConstructor]
        public Tb_Project_FundtemplateController(
            ITb_Project_FundtemplateService service,
            IHttpContextAccessor httpContextAccessor
        )
        : base(service)
        {
            _service = service;
            _httpContextAccessor = httpContextAccessor;
        }

        /// <summary>
        /// 添加项目经费模板
        /// </summary>
        /// <param name="inputDto"></param>
        /// <returns></returns>
        [HttpPost, Route("InsertFundingTemplateAsync")]
        public IActionResult InsertFundingTemplateAsync([FromBody]ProjectFundingTemplateInput_Dto inputDto)
        {
            return Json(_service.InsertFundingTemplateAsync(inputDto));
        }

        /// <summary>
        /// 删除项目经费模板(逻辑删除)
        /// </summary>
        /// <param name="Id"></param>
        /// <returns></returns>
        [HttpGet, Route("SoftDeleteFundingTemplateAsync")]
        public async Task<IActionResult> SoftDeleteFundingTemplateAsync(string Id)
        {
            return Json(await _service.SoftDeleteFundingTemplateAsync(Id));
        }

        /// <summary>
        /// 删除项目经费模板(物理删除)
        /// </summary>
        /// <param name="Id"></param>
        /// <returns></returns>
        [HttpPost,HttpGet, Route("DeleteFundingTemplateAsync")]
        public async Task<IActionResult> DeleteFundingTemplateAsync(string Id)
        {
            return Json(await _service.DeleteFundingTemplateAsync(Id));
        }


        /// <summary>
        /// 修改项目经费模板
        /// </summary>
        /// <returns></returns>
        [HttpPost, Route("UpdateFundingTemplateAsync")]
        public async Task<IActionResult> UpdateFundingTemplateAsync([FromBody] UpdateTemplateSource_Dto inputDto)
        {
            return Json(await _service.UpdateFundingTemplateAsync(inputDto));
        }
    }
}
